home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Apple Reference & Presen…rary 6 (Reseller Edition)
/
Apple Ref. & Pres. Lib.v6.0.toast
/
pc
/
3-Presentations
/
Markets
/
Education
/
HyperCard In Education
/
RotoRooter
/
card_3117.txt
< prev
next >
Wrap
Text File
|
1990-04-02
|
12KB
|
534 lines
-- card: 3117 from stack: in
-- bmap block id: 0
-- flags: 4000
-- background id: 2660
-- name: Rooter
----- HyperTalk script -----
on openCard
hide message
set the loc of message to 22,38
initGraph
eraseMarkers
updateGraph
end openCard
on closeCard
set the loc of message to 22,300
end closeCard
on initGraph
global gLeft, gTop, gUnit, gHSize, gVSize
global gHMid, gVMid, gRight, gBottom
put 204 into gLeft
put 81 into gTop
put 12 into gUnit
put 10 into gHSize
put 10 into gVSize
put gLeft + gHSize * gUnit into gHMid
put gTop + gVSize * gUnit into gVMid
put gLeft + gHSize * gUnit * 2 into gRight
put gTop + gVSize * gUnit * 2 into gBottom
put empty into field fx
set the hilight of bkgnd button "Limit Domain" to false
send mouseUp to bkgnd button "Limit Domain"
stdScale
end initGraph
on updateGraph
hideMarkers
eraseFgnd
set the editBkgnd to true
eraseGraph
drawAxes
choose browse tool
end updateGraph
on setMarkers
global gTop, gBottom, xPLim, yPLim, xNLim, yNLim, gYofXAxis, mkrSet
if field fx is empty then
answer "Specify f(x) first."
else
if gYofXAxis <= gTop or gYofXAxis >= gBottom then
answer "The X-axis must be inside the graph box."
else
if yPLim < 0 or yNLim > 0 then
answer "No roots are visible in this view."
else
eraseMarkers
put xPLim into card field fxPLim
put yPLim into card field fyPLim
put xNLim into card field fxNLim
put yNLim into card field fyNLim
showMarkers
put true into mkrSet
end if
end if
end if
end setMarkers
on eraseMarkers
global mkrSet
set the visible of button PLim to false
set the visible of button NLim to false
eraseFgnd
put empty into card field rootEst
put empty into card field deltaY
put empty into card field fxPLim
put empty into card field fyPLim
put empty into card field fxNLim
put empty into card field fyNLim
put false into mkrSet
choose browse tool
end eraseMarkers
on showMarkers
set the loc of button PLim to xCtoPClip( card field fxPLim ), yCtoPClip( card field fyPLim )
set the loc of button NLim to xCtoPClip( card field fxNLim ), yCtoPClip( card field fyNLim )
set the visible of button PLim to true
set the visible of button NLim to true
end showMarkers
on hideMarkers
set the visible of button PLim to false
set the visible of button NLim to false
end hideMarkers
on doEstimate
global gYofXAxis
if the visible of button PLim is false then
answer "Set the markers first."
else
if card field fyNLim = 0 or card field fyPLim = 0 then
answer "One of the markers is already on a root."
else
eraseFgnd
choose line tool
set lineSize to 2
drag from the loc of button PLim to the loc of button NLim
put card field fxPLim - card field fyPLim * ( card field fxNLim - card field fxPLim ) / ( card field fyNLim - card field fyPLim ) into xRoot
put xCtoP( xRoot ) into x0
put yCalc( xRoot ) into yRoot
put yCtoPClip( yRoot ) into y0
drag from x0, gYofXAxis to x0, y0
if yRoot < 0 then
set the loc of button NLim to x0, y0
put xRoot into card field fxNLim
put yRoot into card field fyNLim
else
set the loc of button PLim to x0, y0
put xRoot into card field fxPLim
put yRoot into card field fyPLim
end if
put xRoot into card field rootEst
put yRoot into card field deltaY
choose browse tool
end if
end if
end doEstimate
-- part 7 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=52 top=140 right=162 bottom=155
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Set Markers
----- HyperTalk script -----
on mouseUp
setMarkers
end mouseUp
-- part 8 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=52 top=165 right=187 bottom=155
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Erase Markers
----- HyperTalk script -----
on mouseUp
eraseMarkers
end mouseUp
-- part 9 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=68 top=200 right=222 bottom=137
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Estimate
----- HyperTalk script -----
on mouseUp
doEstimate
end mouseUp
-- part 10 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=19 top=237 right=252 bottom=101
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 2
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: rootEst
-- part 11 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=104 top=237 right=252 bottom=186
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 2
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: deltaY
-- part 12 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=19 top=281 right=296 bottom=101
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 2
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: fxPLim
-- part 13 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=104 top=281 right=296 bottom=186
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 2
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: fyPLim
-- part 14 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=19 top=299 right=314 bottom=101
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 2
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: fxNLim
-- part 15 (field)
-- low flags: 01
-- high flags: 0002
-- rect: left=104 top=299 right=314 bottom=186
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 2
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: fyNLim
-- part 16 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=19 top=223 right=238 bottom=101
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 2
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: rvLabel
-- part 17 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=104 top=223 right=238 bottom=186
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 2
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: eyLabel
-- part 18 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=19 top=267 right=282 bottom=101
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 2
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: mxLabel
-- part 19 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=104 top=267 right=282 bottom=186
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 2
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: myLabel
-- part 20 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=19 top=256 right=268 bottom=186
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 2
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: mpLabel
-- part 21 (button)
-- low flags: 00
-- high flags: 0001
-- rect: left=6 top=281 right=296 bottom=18
-- title width / last selected line: 0
-- icon id / first selected line: 30813 / 30813
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: mpLabel
-- part 22 (button)
-- low flags: 00
-- high flags: 0001
-- rect: left=6 top=299 right=314 bottom=18
-- title width / last selected line: 0
-- icon id / first selected line: 31589 / 31589
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: mnLabel
-- part 23 (button)
-- low flags: 80
-- high flags: 2000
-- rect: left=318 top=196 right=208 bottom=330
-- title width / last selected line: 0
-- icon id / first selected line: 31589 / 31589
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: NLim
----- HyperTalk script -----
on mouseStillDown
put mConstrain( the mouseH ) into xS
put xPtoC( xS ) into xC
get yCalc( xC )
if it <= 0 then
set the loc of button NLim to xs, yCtoPClip( it )
put xC into card field fxNLim
put it into card field fyNLim
end if
end mouseStillDown
-- part 24 (button)
-- low flags: 80
-- high flags: 2000
-- rect: left=318 top=195 right=207 bottom=330
-- title width / last selected line: 0
-- icon id / first selected line: 30813 / 30813
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: PLim
----- HyperTalk script -----
on mouseStillDown
put mConstrain( the mouseH ) into xS
put xPtoC( xS ) into xC
get yCalc( xC )
if it >= 0 then
set the loc of button PLim to xS, yCtoPClip( it )
put xC into card field fxPLim
put it into card field fyPLim
end if
end mouseStillDown
-- part 26 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=9 top=30 right=58 bottom=111
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 2
-- text size: 14
-- style flags: 2048
-- line height: 18
-- part name: RotoRooter
----- HyperTalk script -----
on mouseUp
answer "Written by Jeffry A. Spain" with "So What?"
end mouseUp
-- part 28 (button)
-- low flags: 00
-- high flags: A002
-- rect: left=16 top=319 right=340 bottom=76
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Return
----- HyperTalk script -----
on mouseUp
global ReturnCard
go ReturnCard
end mouseUp
-- part contents for background part 3
----- text -----
1
-- part contents for background part 4
----- text -----
1
-- part contents for background part 11
----- text -----
-10
-- part contents for background part 10
----- text -----
10
-- part contents for background part 12
----- text -----
-10
-- part contents for background part 13
----- text -----
10
-- part contents for background part 37
----- text -----
0
-- part contents for background part 44
----- text -----
20
-- part contents for background part 48
----- text -----
y unit =
-- part contents for background part 49
----- text -----
x unit =
-- part contents for background part 51
----- text -----
f(x) =
-- part contents for background part 52
----- text -----
Shift
View
-- part contents for background part 53
----- text -----
Change
Scale
-- part contents for card part 16
----- text -----
Root Value
-- part contents for card part 17
----- text -----
Error in Y
-- part contents for card part 20
----- text -----
Marker Positions
-- part contents for card part 18
----- text -----
x
-- part contents for card part 19
----- text -----
y